
<!DOCTYPE html>
<html class="no-js">
<head lang="en">

    <#include "../head_import.html" />

</head>
<body>
<#include "../include/top_nav.html">
    <div class="am-cf admin-main">

        <!-- sidebar start -->
        <#include "../template/left.html">
            <!-- sidebar end -->
            <!-- content start-->
            <div class="admin-content">
                <div class="am-cf am-padding">
                    <div class="am-fl am-cf"><@s.m "global.position"/>: <@s.m "template.function"/> - <@s.m "global.list"/></div>
                </div>
                <div class="am-g">
                    <div class="am-u-sm-12 am-u-sm-centered">
                        <form class="ropt">
                            <input type="hidden" name="root" value="${root}"/>
                            &nbsp; <input type="submit" value="<@s.m "template.create"/>" onclick="this.form.action='add.do';"/>
                            <input type="hidden" name="relPath" value="${relPath!}"/>
                        </form>
                    </div>
                </div>
                <div class="am-g">
                    <div class="am-u-sm-12 am-u-sm-centered">
                        <form method="post" enctype="multipart/form-data">
                            <input type="hidden" name="root" value="${root!}"/>
                            <input type="hidden" name="relPath" value="${relPath!}"/>
                            <table border="0" style="padding-top:3px">
                                <tr>
                                    <td><@s.m "resource.currentDir"/>: ${root!}</td>
                                    <td width="70" align="center"><span id="spanButtonPlaceHolder"></span></td>
                                    <td><input class="cancel" id="btnCancel" type="button" value="<@s.m "global.cancel"/>" onclick="swfu.cancelQueue();" disabled="disabled" /></td>
                                    <td>
                                        <@s.m "template.createDir"/>: <input type="text" name="dirName" size="10" onkeypress="if(event.keyCode==13){$('#dirButton').click();return false;}"/>
                                        <input id="dirButton" type="submit" value="<@s.m "template.createDir"/>" onclick="this.form.action='o_create_dir.do';"/>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr><td colspan="4"><div id="fsUploadProgress"></div></td></tr>
                            </table>
                        </form>
            </div>
    </div>
                <div class="am-g">
                    <div class="am-u-sm-12 am-u-sm-centered">
                        <form id="tableForm" method="post">
                            <@p.table value=list;template,i,has_next><#rt/>
                            <@p.column title="<input type='checkbox' onclick='Pn.checkbox(\"ids\",this.checked)'/>" width="20">
                            <input type="checkbox" name="names" value="${template.name}"/><#t/>
                        </@p.column><#t/>
                        <@p.column code="template.name"><img src="${base}/assets/common/img/file/${template.directory?string('folder','html')}.gif"/> ${template.filename}
                                        </@p.column><#t/>
                                        <@p.column code="template.size" align="right">${template.size} KB</@p.column><#t/>
                                    <@p.column code="template.lastModified" align="center">${template.lastModifiedDate?string('yyyy-MM-dd HH:mm:ss')!}</@p.column><#t/>
                                <@p.column code="global.operate" align="center">
                                <a href="rename.do?root=${root?url}&name=${template.name?url}"><@s.m "template.rename"/></a> | <#rt/>
                                <#if !template.directory><a href="edit.do?root=${root?url}&name=${template.name?url}"><@s.m "global.edit"/></a> | <#rt/></#if>
                                <a href="o_delete_single.do?root=${root?url}&name=${template.name?url}" onclick="if(!confirm('<@s.m "global.confirm.delete"/>')) {return false;}"><@s.m "global.delete"/></a><#t/>
                            </@p.column><#t/>
                        </@p.table>
                        <div>
                            <input type="hidden" name="relPath" value="${relPath!}"/>
                            <input type="button" value="<@s.m "global.delete"/>" onclick="optDelete();"/>
                        </div>
                        </form>
                    </div>
                </div>

    </div>

    </div>

<script src="${base}/thirdparty/swfupload/swfupload.js" type="text/javascript"></script>
<script src="${base}/thirdparty/swfupload/swfupload.queue.js" type="text/javascript"></script>
<script src="${base}/thirdparty/swfupload/fileprogress.js" type="text/javascript"></script>
<script src="${base}/thirdparty/swfupload/handlers.js" type="text/javascript"></script>
<link href="${base}/thirdparty/swfupload/process.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
function optDelete() {
	if(Pn.checkedCount('names')<=0) {
		alert("<@s.m 'error.checkRecord'/>");
		return;
	}
	if(!confirm("<@s.m 'global.confirm.delete'/>")) {
		return;
	}
	var f = document.getElementById('tableForm');
	f.action="o_delete.do";
	f.submit();
}
var swfu;
window.onload=function() {
	var uploadUrl = "o_swfupload.do";
	//在firefox、chrome下，上传不能保留登录信息，所以必须加上jsessionid。
	var jsessionid = $.cookie("JSESSIONID");
	if(jsessionid) {
		uploadUrl += ";jsessionid="+jsessionid;
	}
	swfu=new SWFUpload({
		upload_url : uploadUrl,
		flash_url : "${base}/thirdparty/swfupload/swfupload.swf",
		file_size_limit : "100 MB",
		post_params: {"root" : "${root!}"},
		file_types : "*.html",
		file_types_description : "Html Files",
		file_queue_limit : 0,
		custom_settings : {
			progressTarget : "fsUploadProgress",
			cancelButtonId : "btnCancel"
		},
		debug: false,
		
		button_image_url : "${base}/thirdparty/swfupload/button_notext.png",
		button_placeholder_id : "spanButtonPlaceHolder",
		button_text: "<span class='btnText'><@s.m "resource.upload"/></span>",
		button_width: 81,
		button_height: 24,
		button_text_top_padding: 2,
		button_text_left_padding: 20,
		button_text_style: '.btnText{color:#666666; cursor:pointer;}',
		
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_start_handler : uploadStart,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,
		queue_complete_handler : queueComplete2
	});
};
function queueComplete2(numFilesUploaded) {
	//刷新页面
	location.href="list.do?root=${root!}";
}
</script>

<#include "/common/alert_message.html"/>
</body>
</html>